// JavaScript Document
TOOLS.ready(function(){
	$(window).on('keyup',function(){
		 
	var event=window.event||arguments.callee.caller.arguments[0];
       // mkTrace(event.keyCode+':'+ String.fromCharCode(event.keyCode))
	if(event.keyCode==70){
		 
		doll.fullscreen();
		try{
		window.parent.FastFull()
		console.log('子框控制父框函数FastFull()')
		}catch(e){}
		 
		 
	}
	if(event.keyCode===69){
		    doll.exitFullscreen()	
	}	
	if(event.keyCode === 68 ){
		   var arr=['idfps' , 'info'];
		   for(k in arr){		 
		   var d = document.getElementById(arr[k]).style.display ;
		   document.getElementById(arr[k]).style.display = d!== 'none' ? 'none' : 'block';
		   }
		   window.sta.stop=!window.sta.stop
		   if(window.sta.stop===!true){
		       window.sta.runLoop();
		   }
	}
	
    if(event.keyCode === 190){
        oPlayer.player().currentTime += 10;
    }
    if(event.keyCode === 188){
        oPlayer.player().currentTime -= 10;
    }
	
	if(event.keyCode==80){
	
		if(! oPlayer.player().paused){
		    oPlayer.player().pause();	
		}else{
		    oPlayer.player().play();	
		}
	}
	


	})

    window.setInterval(function(){

        document.getElementById(oPlayer.progressID).style.width = Math.floor(
                (oPlayer.player().currentTime / oPlayer.player().duration)
                * window.innerWidth )+'px';

    },1000)
    //TOOLS.mkDiv('mouseInfo','position:fixed;top:50px;color:#fff;background-color:red;','a')
    //$(window).on('mousemove',function(){
    //    document.getElementById('mouseInfo').innerHTML=TOOLS.getMousePagePos().join('<->')
    //})
    $(window).on('mousemove',function(){
            if(TOOLS.getMousePagePos()[1]>window.innerHeight-10){
               document.getElementById(oPlayer.ctrlerID).style.display = 'block'
            }
        if(TOOLS.getMousePagePos()[1]<=window.innerHeight-50){
            document.getElementById(oPlayer.ctrlerID).style.display = 'none'
        }
    })
   
    window.DkeyClick=function(){
		
		
		   var arr=['idfps' , 'info'];
		   for(k in arr){		 
		   var d = document.getElementById(arr[k]).style.display ;
		   document.getElementById(arr[k]).style.display = d!== 'none' ? 'none' : 'block';
		   }
		   window.sta.stop=!window.sta.stop
		   if(window.sta.stop===!true){
		       window.sta.runLoop();
		   }
		}

	
})

window.mkTrace=function (msg) {
    if (typeof window.mkTrace.boxismked === 'undefined') {
        window.mkTrace.boxismked = true;
        var box = document.createElement('div')
        window.mkTrace.boxid = PLAYER.mkVideoId()+'_boxid'
        box.id = mkTrace.boxid;
        box.style.cssText = 'position:fixed;z-index:99;top:0px;'
        window.document.getElementsByTagName('body')[0].appendChild(box)
    }
    var oDiv = document.createElement('div');
    oDiv.innerHTML = msg;
    oDiv.style.cssText = 'z-index:99;color:#fff; background-color:red;'
        +'width:'+window.innerWidth+'px;font-size:48px;margin-bottom:5px;'
        +' border-radius: 5px;filter: alpha(opacity = 50);opacity: 0.5; '
    document.getElementById(window.mkTrace.boxid).appendChild(oDiv)
    window.setTimeout(function(){oDiv.parentNode.removeChild(oDiv );	},2000)

}



var lib=(function(){
var PLAYER=function(){}
	PLAYER.fn             = PLAYER.prototype;
 	PLAYER.fn.constructor = PLAYER;		
	window.SSSS          = PLAYER;
			
})()
